<?php
abstract class Notify{
	protected $color='red';
	protected $credit=10;
	abstract public function content();
	public function message(){
		return "<span style='color:".$this->color."'>发送".$this->content()."消息,奖励".$this->credit()."积分！</span>";
	}
	public function credit(){
		return $this->credit;
	}
}

class User extends Notify{
	protected $credit=20;
	public function register(){
		$this->color="blue";
		return $this->message();
	}

	public function content(){
		return "我是User";
	}
	public function message(){
		return parent::message();
	}
	
}

class Comment extends Notify{
	public function send(){
		return $this->message();
	}
	public function content(){
		return "我是Comment";
	}
}


echo (new User)->register();
echo "<br>";
echo (new Comment)->send();

//输出
//发送我是User消息,奖励20积分！
//发送我是Comment消息,奖励10积分！